const { Controller } = require('egg');

class TestController extends Controller {


  async create() {
    const { ctx } = this;

    const validateRule = {
      title: 'string',
      content: 'string',
    };

    console.log(validateRule);
    this.logger.debug('debug', ctx.request.body);
    ctx.logger.debug('debug ctx', ctx.request.body);
    this.logger.info('info', ctx.request.body);


    ctx.validate(validateRule, ctx.request.body);

    const data = await ctx.service.test.create(ctx.request.body);

    ctx.body = data;
    ctx.status = 200;

  }


}

module.exports = TestController;
